package org.stone.project.redis.prop;

import cn.hutool.core.util.ObjectUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

@Slf4j
@Data
@Configuration
@ConfigurationProperties(prefix = "custom-redis-prop")
public class CustomRedisProp {
    /**
     * 自定义缓存前缀
     */
    private String prefix;

    /**
     * 默认缓存时间
     */
    private Integer cacheSecond = 60*30;

    @PostConstruct
    public void init(){
        if (ObjectUtil.isEmpty(prefix)) {
            log.warn("系统缓存前缀为空",prefix);
            prefix = "";
        }else {
            log.info("系统缓存前缀为{}",prefix);
        }
    }
}
